#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e6+5,mod = 1e9+7;
inline int qpow(int x,int y)
{
    int res = 1;
    while(y)
    {
        if(y&1) res = res*x%mod;
        y>>=1;
        x = x*x%mod;
    }
    return res;
}
int n,k,a[N];
namespace sub1{
    int cnt,sum,p[N],b[N];
    inline void calc()
    {
        cnt++;
        for(int i = 1;i<=n;i++) b[i] = a[i];
        for(int i = 1;i<=k;i++)
        {
            b[p[i]]-=b[p[i]+1];
            for(int j = p[i]+1;j<=n;j++) b[j] = b[j+1];
        }
        for(int i = 1;i<=n;i++) (sum+=b[i])%=mod;
    }
    void dfs(int x)
    {
        if(x>k) return calc();
        for(int i = 1;i<=n-x;i++)
            p[x] = i,dfs(x+1);
    }
    inline void main()
    {
        dfs(1);
        cout<<(sum+mod)%mod*qpow(cnt,mod-2)%mod;
    }
}
int val[N];
signed main()
{
    freopen("game.in","r",stdin);
    freopen("game.out","w",stdout);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>k;
    for(int i = 1;i<=n;i++) cin>>a[i];
    if(n<=5) sub1::main();
    else
    {
        val[1] = 1;
        for(int i = n-1;i>=n-k;i--) val[1] = val[1]*i%mod; 
        int now1 = 1,now2 = 1;
        for(int i = n;i>n-k;i--) now1 = now1*(i-1)%mod;
        for(int i = n;i>n-k;i--) now2 = now2*(i-2)%mod;
        val[2] = (now1-2*(now1-now2+mod)%mod+mod)%mod;
        val[3] = 1;
        for(int i = n-3;i>=n-k-2;i--) val[3] = val[3]*i%mod; 
        int ans = 0;
        // cout<<val[1]<<' '<<val[2]<<' '<<val[3]<<'\n';
        for(int i = 1;i<=n;i++) (ans+=a[i]*val[min(i,3ll)])%=mod;
        ans = (ans+mod)%mod;
        cout<<ans*qpow(val[1],mod-2)%mod;
    }
    return 0;
}